package view.render.monster
{
	import enums.main.UISize;
	
	import feathers.controls.Label;
	
	import model.vo.monster.LMonsterSpEffectVo;
	
	import view.render.BaseScrollerItem;
	
	
	/**
	 * 大型怪物-特殊攻击效果列表item
	 * @author £iang
	 * 
	 */	
	public class LMonsterSpListItem extends BaseScrollerItem
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 毒信息  */
		public var poisonLabel:Label;
		/** 麻痹信息  */
		public var palsyLabel:Label;
		/** 睡眠信息  */
		public var sleepLabel:Label;
		/** 眩晕信息  */
		public var dizzyLabel:Label;
		/** 灭气信息  */
		public var fatigueLabel:Label;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initializeOther():void
		{
			super.initializeOther();
			poisonLabel = new Label();
			poisonLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( poisonLabel );
			
			palsyLabel = new Label();
			palsyLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( palsyLabel );
			
			sleepLabel = new Label();
			sleepLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( sleepLabel );
			
			dizzyLabel = new Label();
			dizzyLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( dizzyLabel );
			
			fatigueLabel = new Label();
			fatigueLabel.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( fatigueLabel );
		}
		
		/**
		 * 调整组件 
		 * 
		 */		
		override protected function draw():void
		{
			var labelY:Number = ( _itemH - 43 ) / 2 * UISize.DPI_SCALE;
			var leftPadding:Number = UISize.TITLE_PADDING_LEFT * UISize.DPI_SCALE;
			var firstLabelFullW:Number;
			
			firstLabel.x = leftPadding;
			firstLabelFullW = UISize.MAIN_W * _firstPercent;
			
			poisonLabel.y = labelY;
			poisonLabel.x = 0;
			poisonLabel.width  = UISize.MAIN_W / 4;
			
			palsyLabel.y = labelY;
			palsyLabel.x = UISize.MAIN_W / 4;
			palsyLabel.width  = UISize.MAIN_W / 4;
			
			sleepLabel.y = labelY;
			sleepLabel.x = UISize.MAIN_W / 2;
			sleepLabel.width  = UISize.MAIN_W / 4;
			
			dizzyLabel.y = labelY;
			dizzyLabel.x = UISize.MAIN_W * 3 / 4;
			dizzyLabel.width  = UISize.MAIN_W / 4;
			
			fatigueLabel.y = labelY;
			fatigueLabel.x = UISize.MAIN_W;
			fatigueLabel.width  = UISize.MAIN_W / 4;
			
			scollerContainer.x = firstLabelFullW;
			scollerContainer.height = _itemH * UISize.DPI_SCALE;
			scollerContainer.width = UISize.MAIN_W - firstLabelFullW;
			
			this.width = UISize.MAIN_W;
			this.height = _itemH * UISize.DPI_SCALE;
			
		}
		
		/**
		 * 设置item数据 
		 * @param data 数据
		 * 
		 */		
		public function setData( data:LMonsterSpEffectVo ):void
		{
			firstLabel.text = data.attribute;
			poisonLabel.text = data.poison;
			palsyLabel.text = data.palsy;
			sleepLabel.text = data.sleep;
			dizzyLabel.text = data.dizzy;
			fatigueLabel.text = data.fatigue;
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构滚动条容器中的标签 
		 * 
		 */		
		protected override function disposeAnythingInContainer():void
		{
			disposeLabels( [
				"poison", "palsy", "sleep",
				"dizzy", "fatigue"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function LMonsterSpListItem()
		{
			super();
			_itemH = UISize.LMONSTER_SE_ITEM_H;
			_firstPercent = 0.25;
			initialize();
		}
	}
}